/* $Id:user.h jjs $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/
#ifndef __USER_H
#define __USER_H

#include <vector>
#include <map>
#include "../general/channel.h"

/// Data on a user to the game

class user {
  public:
	std::string username;   ///< Login name of the user
	std::string password;   ///< MD5 sum of the password or empty when a server connection
	std::string session;    ///< Last given out session ID
	long sessnr;            ///< counter on connections to the central server, chat and gameserver
	channel *ch;            ///< Channel to the client of this user, can be 0 = down

	/// Save the data of a user
	void save(channel *ch);
};

/// Total list of users on username
extern map<std::string, user> users;

/// Get the data from a user
void load_user(channel *ch);

#endif
